<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveScaffold::Config::List</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveScaffold::Config::List</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/active_scaffold/lib/config/list_rb.html">
                vendor/plugins/active_scaffold/lib/config/list.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Base.html">
                Base
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000113">columns</a>&nbsp;&nbsp;
      <a href="#M000114">columns=</a>&nbsp;&nbsp;
      <a href="#M000117">label</a>&nbsp;&nbsp;
      <a href="#M000112">new</a>&nbsp;&nbsp;
      <a href="#M000116">sorting</a>&nbsp;&nbsp;
      <a href="#M000115">sorting=</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Class <a href="List/UserSettings.html" class="link">ActiveScaffold::Config::List::UserSettings</a><br />

    </div>




    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">empty_field_text</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
what string to use when a field is empty

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">label</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc">
the <a href="List.html#M000117">label</a> for this <a
href="List.html">List</a> action. used for the header.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">per_page</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
how many rows to show at once

</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000112" class="method-detail">
        <a name="M000112"></a>

        <div class="method-heading">
          <a href="#M000112" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(core_config)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000112-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/config/list.rb, line 5</span>
 5:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">core_config</span>)
 6:       <span class="ruby-ivar">@core</span> = <span class="ruby-identifier">core_config</span>
 7: 
 8:       <span class="ruby-comment cmt"># inherit from global scope</span>
 9:       <span class="ruby-comment cmt"># full configuration path is: defaults =&gt; global table =&gt; local table</span>
10:       <span class="ruby-ivar">@per_page</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">per_page</span>
11: 
12:       <span class="ruby-comment cmt"># originates here</span>
13:       <span class="ruby-ivar">@sorting</span> = <span class="ruby-constant">ActiveScaffold</span><span class="ruby-operator">::</span><span class="ruby-constant">DataStructures</span><span class="ruby-operator">::</span><span class="ruby-constant">Sorting</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@core</span>.<span class="ruby-identifier">columns</span>)
14:       <span class="ruby-ivar">@sorting</span>.<span class="ruby-identifier">add</span> <span class="ruby-ivar">@core</span>.<span class="ruby-identifier">model</span>.<span class="ruby-identifier">primary_key</span>, <span class="ruby-value str">'ASC'</span>
15: 
16:       <span class="ruby-comment cmt"># inherit from global scope</span>
17:       <span class="ruby-ivar">@empty_field_text</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">empty_field_text</span>
18:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000113" class="method-detail">
        <a name="M000113"></a>

        <div class="method-heading">
          <a href="#M000113" class="method-signature">
          <span class="method-name">columns</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
provides access to the list of <a href="List.html#M000113">columns</a>
specifically meant for the Table to use
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000113-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/config/list.rb, line 34</span>
34:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">columns</span>
35:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">columns</span> = <span class="ruby-ivar">@core</span>.<span class="ruby-identifier">columns</span>.<span class="ruby-identifier">_inheritable</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@columns</span> <span class="ruby-comment cmt"># lazy evaluation</span>
36:       <span class="ruby-ivar">@columns</span>
37:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000114" class="method-detail">
        <a name="M000114"></a>

        <div class="method-heading">
          <a href="#M000114" class="method-signature">
          <span class="method-name">columns=</span><span class="method-args">(val)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000114-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/config/list.rb, line 38</span>
38:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">columns=</span>(<span class="ruby-identifier">val</span>)
39:       <span class="ruby-ivar">@columns</span> = <span class="ruby-constant">ActiveScaffold</span><span class="ruby-operator">::</span><span class="ruby-constant">DataStructures</span><span class="ruby-operator">::</span><span class="ruby-constant">ActionColumns</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">val</span>)
40:       <span class="ruby-ivar">@columns</span>.<span class="ruby-identifier">action</span> = <span class="ruby-keyword kw">self</span>
41:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000117" class="method-detail">
        <a name="M000117"></a>

        <div class="method-heading">
          <a href="#M000117" class="method-signature">
          <span class="method-name">label</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000117-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000117-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/config/list.rb, line 61</span>
61:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">label</span>
62:       <span class="ruby-ivar">@label</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">as_</span>(<span class="ruby-ivar">@label</span>) <span class="ruby-operator">:</span> <span class="ruby-ivar">@core</span>.<span class="ruby-identifier">label</span>
63:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000116" class="method-detail">
        <a name="M000116"></a>

        <div class="method-heading">
          <a href="#M000116" class="method-signature">
          <span class="method-name">sorting</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000116-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000116-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/config/list.rb, line 55</span>
55:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sorting</span>
56:       <span class="ruby-ivar">@sorting</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ActiveScaffold</span><span class="ruby-operator">::</span><span class="ruby-constant">DataStructures</span><span class="ruby-operator">::</span><span class="ruby-constant">Sorting</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@core</span>.<span class="ruby-identifier">columns</span>)
57:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000115" class="method-detail">
        <a name="M000115"></a>

        <div class="method-heading">
          <a href="#M000115" class="method-signature">
          <span class="method-name">sorting=</span><span class="method-args">(val)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
the default <a href="List.html#M000116">sorting</a>. should be an array of
hashes of {column_name =&gt; direction}, e.g. [{:a =&gt;
&#8216;desc&#8217;}, {:b =&gt; &#8216;asc&#8217;}]. to just sort on one
column, you can simply provide a hash, though, e.g. {:a =&gt;
&#8216;desc&#8217;}.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000115-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000115-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/config/list.rb, line 50</span>
50:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sorting=</span>(<span class="ruby-identifier">val</span>)
51:       <span class="ruby-identifier">val</span> = [<span class="ruby-identifier">val</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>
52:       <span class="ruby-identifier">sorting</span>.<span class="ruby-identifier">clear</span>
53:       <span class="ruby-identifier">val</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">clause</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sorting</span>.<span class="ruby-identifier">add</span> <span class="ruby-operator">*</span><span class="ruby-constant">Array</span>(<span class="ruby-identifier">clause</span>).<span class="ruby-identifier">first</span> }
54:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>